<template>
  <div>
    <van-row>
      <van-col span="6"><lef></lef></van-col>
      <van-col span="18">
        <van-row>
          <van-col span="24"><headers></headers></van-col>
        </van-row>
        <van-row>
          <van-col span="6">
            <van-field
                v-model="name"
                name="name"
                label="请输入名称"
                placeholder="请输入职务名称"
                :rules="[{ required: true, message: '请输入职务名称' }]"
            /> </van-col>
          <van-col span="6">
            <van-field
                v-model="code"
                name="name"
                label="请输入编码"
                placeholder="请输入职务编码"
                :rules="[{ required: true, message: '请输入职务编码' }]"
            /> </van-col>
          <van-col span="3"><van-button type="info">查询</van-button></van-col>
          <van-col span="5"><van-button disabled type="primary">重置</van-button>
          </van-col>

        </van-row>
        <van-row>
          <van-col span="2">
            <van-button type="info" @click="add_show">新增</van-button>
            <div v-show="is_show">
              <van-button plain type="primary" @click="ss">取消</van-button>
              <form action="" @submit.prevent="addd">
                <p>职位名称: <input type="text" v-model="form1.name"></p>
                <p>职位编码: <input type="text" v-model="form1.code"></p>
                <p>职位排序: <input type="text" v-model="form1.sort"></p>
                <p>职位描述: <input type="text" v-model="form1.content"></p>
                <button type="submit">提交</button>
              </form>
            </div>
          </van-col>
          <van-col span="2">
            <van-button disabled type="primary">导出</van-button>
          </van-col>
          <van-col span="2">
            <van-uploader :after-read="afterRead" multiple accept=".xls">导入</van-uploader>
          </van-col>
        </van-row>
        <van-row>
          <table border="1" cellspacing="0">
            <tr>
              <td><input type="checkbox"></td>
              <td>序号</td>
              <td>岗位名称</td>
              <td>岗位编码</td>
              <td>岗位排序</td>
              <td>岗位描述</td>
              <td>操作</td>
            </tr>
            <tr v-for="i in gangweilist" :key="i.id">
              <td><input type="checkbox"></td>
              <td>{{i.id}}</td>
              <td>{{i.name}}</td>
              <td>{{i.code}}</td>
              <td>{{i.sort}}</td>
              <td>{{i.content}}</td>
              <td>
                <button @click="bumen_del(i.id)">删除</button></td>
            </tr>
          </table>
        </van-row>
      </van-col>
    </van-row>


  </div>
</template>

<script>
import Lef from "@/components/veiw/lef";
import Headers from "@/components/veiw/headers";
import myaxios from "@/http/axios";
export default {
  name: "gangwei",
  components: {Headers, Lef},
  data() {
    return {
      data1: '',
      name:'',
      code:'',
      is_show:false,
      form1:{},
      gangweilist:[]
    }
  },
  methods: {
    get_gangwei(){
      myaxios('gangwei','get').then(res=>{
        this.gangweilist = res.list

      })
    },
    bumen_del(id){
      myaxios('gangwei','delete',id).then(res=>{
        alert(res.msg)
      })
    }
  },
  mounted() {
    this.get_gangwei()
  }
}
</script>

<style scoped>

</style>